<html>
<head><meta charset="utf-8"><title>How to run a test where `is_nightly_build` is `true`? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20run.20a.20test.20where.20.60is_nightly_build.60.20is.20.60true.60.3F.html">How to run a test where `is_nightly_build` is `true`?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="224624387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20run%20a%20test%20where%20%60is_nightly_build%60%20is%20%60true%60%3F/near/224624387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Henry Boisdequin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20run.20a.20test.20where.20.60is_nightly_build.60.20is.20.60true.60.3F.html#224624387">(Jan 31 2021 at 05:32)</a>:</h4>
<p>I would like to run a test that outputs the nightly message.</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">else</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">tcx</span><span class="p">.</span><span class="n">sess</span><span class="p">.</span><span class="n">is_nightly_build</span><span class="p">()</span><span class="w"> </span><span class="o">&amp;&amp;</span><span class="w"> </span><span class="n">is_const_fn</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="o">..</span><span class="p">.</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>As you can see, this code only runs when <code>.is_nightly_build()</code> returns <code>true</code>. Is there a way I can run a test where that function returns <code>true</code> so I can get the "nightly effects"?</p>



<a name="224646149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20run%20a%20test%20where%20%60is_nightly_build%60%20is%20%60true%60%3F/near/224646149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20run.20a.20test.20where.20.60is_nightly_build.60.20is.20.60true.60.3F.html#224646149">(Jan 31 2021 at 14:00)</a>:</h4>
<p>I don’t know the answer to your question off the top of my head. That said, if I had to find this out: I’d grep for other uses of <code>is_nightly_build</code> and then find other places where that adds to diagnostics, then I’d grep for those diagnostics and see if any of those tests have compiletest headers that do what you want.</p>



<a name="224646783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20run%20a%20test%20where%20%60is_nightly_build%60%20is%20%60true%60%3F/near/224646783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Henry Boisdequin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20run.20a.20test.20where.20.60is_nightly_build.60.20is.20.60true.60.3F.html#224646783">(Jan 31 2021 at 14:15)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116107">davidtwco</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20to.20run.20a.20test.20where.20.60is_nightly_build.60.20is.20.60true.60.3F/near/224646149">said</a>:</p>
<blockquote>
<p>I don’t know the answer to your question off the top of my head. That said, if I had to find this out: I’d grep for other uses of <code>is_nightly_build</code> and then find other places where that adds to diagnostics, then I’d grep for those diagnostics and see if any of those tests have compiletest headers that do what you want.</p>
</blockquote>
<p>Thanks, I'll try that, I think that the rustc-dev-guide should talk about testing where <code>is_nightly_build</code> is <code>true</code> though. If I find it out, I'll make a PR.</p>



<a name="224674993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20run%20a%20test%20where%20%60is_nightly_build%60%20is%20%60true%60%3F/near/224674993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20run.20a.20test.20where.20.60is_nightly_build.60.20is.20.60true.60.3F.html#224674993">(Feb 01 2021 at 00:44)</a>:</h4>
<p><span class="user-mention" data-user-id="383558">@Henry Boisdequin</span> all tests are run with nightly, you can assume this is always true</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>